using System;
using System.Collections.Generic;
using System.Text;
using System.Data.Common;
using System.Data;
using XBLib.Dal.AdoDal;
using DataInfo;
using KenLib.Common;
namespace KenLib.Dal
{
    public class 業務スキル情報Dao : BaseAdoDao
      {
          private string m_requestTime;
          private string m_displayTime;
          public int Insert(業務スキル情報 obj)
          {
              int i = 0;
              try
              {
                  m_requestTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  DbParameter param20 = _daoHelper.CreateParameter("@廃止区分", obj.廃止区分, DbType.Int16);
                  DbParameter param1 = _daoHelper.CreateParameter("@業務スキル名", obj.業務スキル名, DbType.String);
                  DbParameter param2 = _daoHelper.CreateParameter("@レベル", obj.レベル, DbType.String);
                  DbParameter param3 = _daoHelper.CreateParameter("@発行機関", obj.発行機関, DbType.String);
                  DbParameter param4 = _daoHelper.CreateParameter("@発行日", obj.発行日, DbType.DateTime);
                  DbParameter param5 = _daoHelper.CreateParameter("@社員ID", obj.社員ID, DbType.Int32);
                  DbCommand command = _daoHelper.CreateCommand(CommandNameManager.Insert_HumanWorkSkillInfo, CommandType.StoredProcedure,param20, param1, param2, param3, param4, param5);
                  i = _daoHelper.Execute(command);
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteLog("", "", "INSERT", "Insert_HumanWorkSkillInfo", m_requestTime, m_displayTime);
              }
              catch (Exception ex)
              {
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteErr("", "", "SELECT", ex.Message, m_requestTime, m_displayTime);
              }
              return i;
          }

        public int Update(業務スキル情報 obj)
          {
              int i = 0;
              try
              {
                  m_requestTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  DbParameter param20 = _daoHelper.CreateParameter("@廃止区分", obj.廃止区分, DbType.Int16);
                  DbParameter param0 = _daoHelper.CreateParameter("@ID", obj.ID, DbType.Int32);
                  DbParameter param1 = _daoHelper.CreateParameter("@業務スキル名", obj.業務スキル名, DbType.String);
                  DbParameter param2 = _daoHelper.CreateParameter("@レベル", obj.レベル, DbType.String);
                  DbParameter param3 = _daoHelper.CreateParameter("@発行機関", obj.発行機関, DbType.String);
                  DbParameter param4 = _daoHelper.CreateParameter("@発行日", obj.発行日, DbType.DateTime);
                  DbParameter param5 = _daoHelper.CreateParameter("@社員ID", obj.社員ID, DbType.Int32);
                  DbCommand command = _daoHelper.CreateCommand(CommandNameManager.Update_HumanWorkSkillInfo, CommandType.StoredProcedure,param20, param0, param1, param2, param3, param4, param5);
                  i = _daoHelper.Execute(command);
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteLog("", "", "UPDATE", "Update_HumanWorkSkillInfo", m_requestTime, m_displayTime);
              }
              catch (Exception ex)
              {
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteErr("", "", "SELECT", ex.Message, m_requestTime, m_displayTime);
              }
              return i;
          }

          public int Delete(int id)
          {
              int i = 0;
              try
              {
                  m_requestTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  DbParameter param0 = _daoHelper.CreateParameter("@ID", id, DbType.Int32);

                  DbCommand command = _daoHelper.CreateCommand(CommandNameManager.Delete_HumanWorkSkillInfo, CommandType.StoredProcedure, param0);
                  i = _daoHelper.Execute(command);
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteLog("", "", "DELETE", "Delete_HumanWorkSkillInfo", m_requestTime, m_displayTime);
              }
              catch (Exception ex)
              {
                  m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                  ExportFile.WriteErr("", "", "SELECT", ex.Message, m_requestTime, m_displayTime);
              }
              return i;
          }

        public int InsertPartial(業務スキル情報 obj)
        {
            int i = 0;
            try
            {
                m_requestTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                DbParameter param20 = _daoHelper.CreateParameter("@廃止区分", obj.廃止区分, DbType.Int16);
                DbParameter param21 = _daoHelper.CreateParameter("@業務スキルコード", obj.業務スキルコード, DbType.String);
                DbParameter param1 = _daoHelper.CreateParameter("@業務スキル名", obj.業務スキル名, DbType.String);
                DbParameter param2 = _daoHelper.CreateParameter("@レベル", obj.レベル, DbType.String);
                DbParameter param3 = _daoHelper.CreateParameter("@発行機関", obj.発行機関, DbType.String);
                DbParameter param4 = _daoHelper.CreateParameter("@発行日", obj.発行日, DbType.DateTime);
                DbParameter param5 = _daoHelper.CreateParameter("@社員ID", obj.社員ID, DbType.Int32);
                DbCommand command = _daoHelper.CreateCommand(CommandNameManager.sp_Insert業務スキル情報_Partial, CommandType.StoredProcedure, param20,param21, param1, param2, param3, param4, param5);
                i = _daoHelper.Execute(command);
                m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                ExportFile.WriteLog("", "", "INSERT", "sp_Insert業務スキル情報_Partial", m_requestTime, m_displayTime);
            }
            catch (Exception ex)
            {
                m_displayTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                ExportFile.WriteErr("", "", "INSERT", ex.Message, m_requestTime, m_displayTime);
            }
            return i;
        }

          #region TUNG

        public void Insert_frmJ_StaffWorkSkillInput(業務スキル情報 obj)
        {
            DbParameter param1 = _daoHelper.CreateParameter("@廃止区分", obj.廃止区分, DbType.Int16);
            DbParameter param2 = _daoHelper.CreateParameter("@業務スキルコード", obj.業務スキルコード, DbType.Int32);
            DbParameter param3 = _daoHelper.CreateParameter("@業務スキル名", obj.業務スキル名, DbType.String);
            DbParameter param4 = _daoHelper.CreateParameter("@レベル", obj.レベル, DbType.String);
            DbParameter param5 = _daoHelper.CreateParameter("@発行機関", obj.発行機関, DbType.String);
            DbParameter param6 = _daoHelper.CreateParameter("@発行日", obj.発行日, DbType.DateTime);
            DbParameter param7 = _daoHelper.CreateParameter("@社員ID", obj.社員ID, DbType.Int32);
            DbCommand dbcommand = _daoHelper.CreateCommand("sp_Insert_frmJ_StaffWorkSkillInput_TUNG", CommandType.StoredProcedure, param1, param2, param3, param4, param5, param6, param7);
            _daoHelper.Query(dbcommand);

        }


        public DataTable Get_frmJ_StaffWorkSkillInput(int ID)
        {
            DbParameter param1 = _daoHelper.CreateParameter("@ID", ID, DbType.Int32);
            DbCommand dbcommand = _daoHelper.CreateCommand("sp_Select_frmJ_StaffWorkSkillInput_TUNG", CommandType.StoredProcedure,param1);
            return _daoHelper.Query(dbcommand);
            
        }

        public void Update_frmJ_StaffWorkSkillInput(業務スキル情報 obj)
        {
            DbParameter param1 = _daoHelper.CreateParameter("@ID", obj.ID, DbType.Int32);
            DbParameter param2 = _daoHelper.CreateParameter("@業務スキルコード", obj.業務スキルコード, DbType.Int32);
            DbParameter param3 = _daoHelper.CreateParameter("@業務スキル名", obj.業務スキル名, DbType.String);
            DbParameter param4 = _daoHelper.CreateParameter("@レベル", obj.レベル, DbType.String);
            DbParameter param5 = _daoHelper.CreateParameter("@発行機関", obj.発行機関, DbType.String);
            DbParameter param6 = _daoHelper.CreateParameter("@発行日", obj.発行日, DbType.DateTime);
            DbCommand dbcommand = _daoHelper.CreateCommand("sp_Update_frmJ_StaffWorkSkillInput_TUNG", CommandType.StoredProcedure, param1, param2, param3, param4, param5, param6);
            _daoHelper.Query(dbcommand);

        }

        public DataTable Select_frmJ_StaffWorkSkillInput(業務スキル情報 obj)
        {
            
            DbParameter param1 = _daoHelper.CreateParameter("@業務スキルコード", obj.業務スキルコード, DbType.Int32);
            DbParameter param2 = _daoHelper.CreateParameter("@社員ID", obj.社員ID, DbType.Int32);
            DbCommand dbcommand = _daoHelper.CreateCommand("sp_Get_frmJ_StaffWorkSkillInput_TUNG", CommandType.StoredProcedure, param1, param2);
            return _daoHelper.Query(dbcommand);
        }

          
          #endregion

      }
}
